package com.wkbb.sports.service.impl;

import com.wkbb.sports.dto.StudentOnlineRoomDto;
import com.wkbb.sports.mapper.StudentOnlineMapper;
import com.wkbb.sports.model.*;
import com.wkbb.sports.service.StudentOnlineService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
public class StudentOnlineServiceImpl implements StudentOnlineService {

    @Autowired
    private StudentOnlineMapper onlineMapper;

    @Override
    public StudentOnlineHall findHall(Long studentId) {
        return onlineMapper.findHall(studentId);
    }

    @Override
    public Integer getStudentAvgCount(Map<String, Object> params) {
        return onlineMapper.getStudentAvgCount(params);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int insertOnlineHall(StudentOnlineHall onlineHall) {
        return onlineMapper.insertOnlineHall(onlineHall);
    }

    @Override
    public int updateOnlineHall(StudentOnlineHall onlineHall) {
        return onlineMapper.updateOnlineHall(onlineHall);
    }

    @Override
    public List<StudentOnlineHall> getHallList(StudentOnlineHall onlineHall) {
        return onlineMapper.getHallList(onlineHall);
    }

    @Override
    public int insertOnlineRoomRecord(StudentOnlineRoomRecord onlineRoomRecord) {
        return onlineMapper.insertOnlineRoomRecord(onlineRoomRecord);
    }

    @Override
    public int insertOnlineRoomStuBatch(List<StudentOnlineRoomStu> stuList) {
        return onlineMapper.insertOnlineRoomStuBatch(stuList);
    }
    @Override
    public int insertPracticeBatch(List<HlifeStudentPractice> list){
        return onlineMapper.insertPracticeBatch(list);
    }

    @Override
    public List<StudentOnlineRoomDto> getHallRoomList() {
        return onlineMapper.getHallRoomList();
    }

    @Override
    public void offlineHall() {
        onlineMapper.offlineRoom();
        onlineMapper.offlineHall();
    }

    @Override
    public int insertOnlineRoom(StudentOnlineRoom onlineRoom) {
        return onlineMapper.insertOnlineRoom(onlineRoom);
    }

    @Override
    public int updateOnlineRoom(StudentOnlineRoom onlineRoom) {
        return onlineMapper.updateOnlineRoom(onlineRoom);
    }
}
